package dao;

import bean.Teacher;

import java.sql.ResultSet;
import java.sql.SQLException;
public class Teacherdao extends Basedao {
    public Teacher login(String teaid, String password) {
        String sql = "select * from  teacher where teacherid = '" + teaid + "' and password = '" + password + "'";
        ResultSet resultSet = query(sql);
        try {
            if (resultSet.next()) {
                Teacher administrator = new Teacher();
                administrator.settid(resultSet.getString("teacherid"));
                administrator.setPassword(resultSet.getString("password"));
                return administrator;
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}